home *** CD-ROM | disk | FTP | other *** search
- ; FFLFNP.ASM Version 1.0
-
- ; Version 1.0 adds NOPRINT function to Version 5.0 of FFLF.COM
- ; to create new program.
-
- ; Memory-resident program to send form feed and line feed
- ; characters to printer.
-
- ; Alt-* [PrtSc] = form feed
- ; Alt-/ = line feed
-
- ; Disables Shift-PrtSc and Ctrl-PrtSc if printer is not ready.
-
- ; Checks printer status, beeps if printer not ready.
- ; Includes installation messages.
-
- ; Checks for prior installation by looking for four words of code.
- ; Uses interrupt 10h to generate beep.
-
- ; Written in CHeap ASseMbler format by :
- ; L. R. Holliday
- ; Vista Chemical Company
- ; P. O. Box 500
- ; Ponca City, Oklahoma 74601
- ; (405) 767-6326
-
- fflfnp proc far
- jmp set_up ; Jump to initialize
- addr_bx ds 2,0 ; Space to store KBINT offset
- addr_es ds 2,0 ; Space to store KBINT segment
- flag db 0fh
- new_kbint sti ; Interrupts on
- push ax ; Store registers
- push dx
- push bx
- push cx
- mov ah,02 ; Get shift state
- int 16h ; through BIOS
- test al,07 ; Is Ctrl or Shift key pressed ?
- jnz noprint ; If so, jump to noprint
- test al,08 ; Is Alt key pressed ?
- jz exit ; If not, jump to exit
- in al,60h ; Get key scan code
- cmp al,37h ; Is it * [PrtSc] Key ?
- jz formfeed ; If so, jump to formfeed
- cmp al,35h ; Is it / Key ?
- jz linefeed ; If so, jump to linefeed
- jmps exit ; If none of above, jump to exit
- noprint in al,60h ; Get key scan code
- cmp al,37h ; Is it * [PrtSc] Key ?
- jnz exit ; If not, jump to exit
- mov dx,0000 ; Select printer 1
- mov ah,02 ; check printer status
- int 17h
- cmp ah,90h ; is printer on-line ?
- jnz beep ; if not, then beep and reset keyboard
- jmps exit ; if so, then exit to DOS PrtSc function
- formfeed mov dx,0000 ; Select printer 1
- mov ah,02 ; check printer status
- int 17h
- cmp ah,90h ; is printer on-line ?
- jnz beep ; if not, then beep and reset keyboard
- mov ax,000Ch ; Put Formfeed character in AL
- int 17h ; Send to printer
- jmps kb_reset ; Jump to KeyBoard Reset
- linefeed mov dx,0000 ; Select printer 1
- mov ah,02 ; check printer status
- int 17h
- cmp ah,90h ; is printer on-line ?
- jnz beep ; if not, then beep and reset keyboard
- mov ax,000Ah ; Put Linefeed character in AL
- int 17h ; Send to printer
- jmps kb_reset ; Jump to KeyBoard Reset
- beep mov ah,0eh ; Set for write to screen
- mov cx,0001 ; Number of characters to write
- mov al,07 ; Beep character
- int 10h ; Send to screen
- kb_reset in al,61h ; These instructions reset the
- mov ah,al ; keyboard
- or al,80h ; ......
- out 61h,al ; ......
- mov al,ah ; ......
- out 61h,al ; ......
- cli ; Turn interrupts off
- mov al,20h ; Send End-of-Interrupt
- out 20h,al ; signal
- pop cx ; Restore registers
- pop bx
- pop dx
- pop ax
- iret ; Return to interrupted program
- exit pop cx ; Restore registers
- pop bx
- pop dx
- pop ax
- seg cs ; cs:
- jmpf addr_bx ; Return to old kbint
- set_up mov ah,30h ; Check DOS Version
- int 21h
- cmp al,2 ; Is it 2 or higher ?
- jae check ; If so, check for prior installation
- mov dx,offset(err_msg2)
- jmps msg_exit ; If not, issue error message
- check mov dx,offset(new_kbint) ; Offset to begin search
- mov ax,cs ; DS:SI points to destination
- mov es,ax ; ES:DI points to source
- nextseg dec ax ; Search previous segment
- mov ds,ax ; Load new segment to search
- mov si,dx ; Point to beginning of string
- mov di,dx ; Point to beginning of string
- mov cx,0004h ; Four words must match
- cld ; Clear DF for autoincrement
- repz ; Repeat until zero
- cmpsw ; Compare words
- jnz notfound ; If no match, keep trying
- ; If found, check to see if this is a local copy, rather than installed
- cmpb flag,0fh ; Is this installed copy ?
- jnz installed ; If installed, skip installation
- notfound cmp ax,0001h ; Stop searching at low memory
- jnz nextseg ; Keep trying if not
- install seg cs ; cs:
- movb flag,00h ; Set installation byte
- mov AX,3509h ; Get BIOS KBINT address through
- int 21h ; DOS GET_VECTOR service
- seg cs ; cs:
- mov addr_bx,bx ; Store offset and segment
- seg cs ; cs:
- mov addr_es,es ; in spaces allocated
- push cs ; Set DS to CS
- pop ds
- mov dx,offset(new_kbint) ; Address of new kbint
- mov ax,2509h ; Set vector to new kbint
- int 21h ; through DOS SET_VECTOR service
- mov dx,offset(inst_msg)
- mov ah,9 ; Display installation message
- int 21h
- mov dx,offset(set_up) ; Address of end of resident code
- int 27h ; Terminate, but stay resident
- installed mov dx,offset(err_msg1)
- msg_exit mov ah,9 ; Display error message
- push cs
- pop ds ; Restore DS
- int 21h
- int 20h ; Terminate
- end endp
-
- inst_msg db 13,10,' FORMFEED - LINEFEED - NOPRINT Version 1.0',13,10
- db 13,10,' by L. R. Holliday',13,10
- db 13,10,' Memory-Resident Portion Installed',13,10
- db 13,10,' Press Alt-* to Send FormFeed to Printer',13,10
- db 13,10,' Press Alt-/ to Send LineFeed to Printer',13,10
- db 13,10,' Shift-PrtSc and Ctrl-Prtsc Disabled'
- db ' IF Printer is NOT Ready',13,10
- db ' '
- db ' --',13,10,36
-
- err_msg1 db 13,10,' FORMFEED - LINEFEED - NOPRINT Version 1.0',13,10
- db 13,10,' by L. R. Holliday',13,10
- db 07,13,10,' --- Already Installed ---',13,10,36
-
- err_msg2 db 13,10,' FORMFEED - LINEFEED - NOPRINT Version 1.0',13,10
- db 13,10,' by L. R. Holliday',13,10
- db 07,13,10,' --- Wrong Dos Version ---',13,10,36